package register;


import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;


/**
 * 本地注册中心
 */
public class LocalRegistry {
    private final static Map<String,Class<?>> register = new ConcurrentHashMap<>();//key为服务名称，value为服务对应的实现类字节码
    //注册服务
    public static void registService(String serviceName,Class<?> serviceImpl){
        register.put(serviceName,serviceImpl);
    }
    //获取服务
    public static Class<?> getService(String serviceName){
        return register.get(serviceName);
    }
    //删除服务
    public static void deleteService(String serviceName){
        register.remove(serviceName);
    }
}
